
const defaultState={
    mv:[],
    flag:true,
    test:"测试api接口",
    num:1000
}



export const data =(state = defaultState , action)=>{
    const{type,payload}=action;
    switch(type){
        case "changeFlag":
  
        return {...state,data,flag:payload};  //解构 返回新的state
        break;
            
        case "changeDataTest":

        return {...state,test:payload};  //解构 返回新的state
        break;
               
                        
        case "changeDataNum":
         return {...state,num:state.num+payload};  //解构 返回新的state
        break;

        case "getMovieList":
            return  {...state,mv:payload}
            break;


        default:
            return state
            break;
    }
  }